package tools.Jalview;

public class Feature {

	private String description, sequenceId,sequenceIdRaw, featureType,group;
	private int sequenceIndex,start, end,shift;
	
	public Feature(String description, String sequenceId, String featureType, String group, int sequenceIndex, int start, int end) {
		this.description = description;
		this.sequenceId = sequenceId;
		this.sequenceIdRaw = sequenceId;
		this.shift=0;
		if(sequenceId.replace('/', '¤').split("¤").length==2){
			String[] tmp=sequenceId.replace('/', '¤').split("¤");
			if(tmp[1].split("-").length==2){
				try{
					this.shift=Integer.parseInt(tmp[1].split("-")[0]);
//					System.err.println(tmp[0]);
					this.sequenceId= tmp[0];
//					System.err.println(sequenceId);
				}catch (Exception e) {
					shift=0;
				}
			}
		}
//		System.err.println(sequenceId);
		this.featureType = featureType;
		this.group = group;
		this.sequenceIndex = sequenceIndex;
		this.start = start;
		this.end = end;
	}
	
	
	
	public String getFeatureType() {
		return featureType;
	}



	public String getGroup() {
		return group;
	}



	public String toStringRaw(){
		return description+"\t"+sequenceIdRaw+"\t"+sequenceIndex+"\t"+start+"\t"+end+"\t"+featureType;
	}
	
	public String toString(){
//		System.err.println(sequenceId);
		return description+"\t"+sequenceId+"\t"+sequenceIndex+"\t"+(shift+start)+"\t"+(shift+end)+"\t"+featureType;
	}
}
